#if !defined(WORLDOBJECT_H)
#define WORLDOBJECT_H

#include "node.h"
#include "nodetype.h"
#include <d3dx9.h>

namespace gunsmith
{
/*! \class CNodeWorldObject
	\brief Provides main attributes like position, rotation etc. to represent an object in the world. */
class CNodeWorldObject : public CNode
{
public:
						CNodeWorldObject				(ENODETYPE eType);
	virtual				~CNodeWorldObject				();
	const D3DXMATRIX*	GetLocalTransformationMatrix	()									const;
	const D3DXMATRIX*	GetWorldTransformationMatrix	()									const;
	const D3DXVECTOR3&	GetDirection					()									const;
	const D3DXVECTOR3&	GetPosition						()									const;
	const D3DXVECTOR3&	GetRotation						()									const;
	const D3DXVECTOR3&	GetScale						()									const;
	virtual void		SetDirection					(const D3DXVECTOR3& vDirection);
	virtual void		SetPosition						(const D3DXVECTOR3& vPosition);
	virtual void		SetRotation						(const D3DXVECTOR3& vRotation);
	virtual void		SetScale						(const D3DXVECTOR3& vScale);
	virtual void		Update							(float fDelta, void *pData = NULL);

protected:
	bool		m_bCollideable;
	D3DXVECTOR3	m_vDirection;
	D3DXVECTOR3 m_vPosition;
	D3DXVECTOR3 m_vRotation;
	D3DXVECTOR3 m_vScale;
	D3DXMATRIX	m_matLocalTransformation;
	D3DXMATRIX	m_matWorldTransformation;

private:
	void	UpdateLocalTransformationMatrix	();
	void	UpdateWorldTransformationMatrix	();
	void	UpdateChildrenWorldMatrices		(CNode *pNode);
};
};

#endif  //WORLDOBJECT_H
